<?php
require_once 'start.php';

$request = new \lib\Request();

$login_sig = '';
$fileList = scandir(ROOT_PATH . DS . 'cookie');
if(isset($fileList['2'])){
    $content = file_get_contents(ROOT_PATH . DS . 'cookie' . DS . $fileList['2']);
    if(preg_match('/pt_login_sig\s(\S.*)/', $content, $match)){
        $login_sig = $match[1];
        $login_sig = preg_replace('/\s/', '', $login_sig);
    }
}

$url = 'https://ssl.ptlogin2.qq.com/ptqrlogin?u1=https://web2.qq.com/proxy.html&ptqrtoken='.$_POST['token'].'&ptredirect=0&h=1&t=1&g=1&from_ui=1&ptlang=2052&action=0-1-1539617495419&js_ver=10284&js_type=1&login_sig='.$login_sig.'&pt_uistyle=40&aid=501004106&daid=164&mibao_css=m_webqq&';
$referer = 'https://xui.ptlogin2.qq.com/cgi-bin/xlogin?daid=164&target=self&style=40&pt_disable_pwd=1&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=https%3A%2F%2Fweb2.qq.com%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001';

$response = $request->url($url)->setReferer($referer)->autoCookie()->send();

echo $response;
exit;